Skip to content

PG-2398 PostgreSQL 16 support#587

Merged
jeltz merged 10 commits into
percona:mainfrom
jeltz:pg16
Jun 12, 2026
Merged

PG-2398 PostgreSQL 16 support#587
jeltz merged 10 commits into
percona:mainfrom
jeltz:pg16

Conversation

@jeltz

@jeltz jeltz commented May 21, 2026

Copy link
Copy Markdown
Collaborator

This adds support for PostgreSQL 16.

Questions

  • The alternate expected files for pg_regress are very ugly. Not sure what we should do there.
  • How should we document that we now support PostgreSQL 16? How much should we advertize it? Right now I have done nothing.

@codecov-commenter

codecov-commenter commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.11%. Comparing base (53115e1) to head (daec7b7).

❌ Your project status has failed because the head coverage (76.27%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #587      +/-   ##
==========================================
+ Coverage   56.08%   56.11%   +0.02%     
==========================================
  Files          69       69              
  Lines       11051    11051              
  Branches     2738     2738              
==========================================
+ Hits         6198     6201       +3     
+ Misses       3515     3512       -3     
  Partials     1338     1338              
Components Coverage Δ
access 81.04% <ø> (ø)
bin 63.76% <ø> (ø)
catalog 78.53% <ø> (ø)
common 88.23% <ø> (ø)
encryption 63.63% <ø> (ø)
keyring 65.55% <ø> (ø)
src 87.01% <ø> (+0.20%) ⬆️
smgr 90.20% <ø> (+1.03%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jeltz
jeltz force-pushed the pg16 branch 2 times, most recently from b9c536c to 32d5adc Compare May 26, 2026 12:54
@jeltz
jeltz force-pushed the pg16 branch 20 times, most recently from 6f03ce1 to 273cb2b Compare June 9, 2026 14:19
@jeltz
jeltz marked this pull request as ready for review June 9, 2026 14:19

@dutow dutow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, some of my comments are about preexisting issues in our frontend code, so maybe those should be addressed in a separate PR.

Commit messages also have a few typos:

  • sepfific
  • JSOn
  • PostgeSQL
  • paritioned
  • afor

Comment thread ci_scripts/build-and-install-psp.sh Outdated
Comment thread t/tde_heap.pl
Comment thread fetools/pg16/pg_basebackup/bbstreamer.h
Comment thread fetools/pg16/pg_rewind/pg_rewind.c
Comment thread fetools/pg16/pg_waldump/pg_waldump.c
* pg_tde may exists and contain keys and providers for the WAL
* encryption
*/
if (strcmp(dirname, PG_TDE_DATA_DIR))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this condition inverted?

also, isn't dirname a full path?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that code looks very suspicious. But that is for another PR.

Comment thread src/pg_tde_fe.c
Comment thread t/tde_heap_aes_256.pl
@jeltz jeltz changed the title PostgreSQL 16 support PG-2398 PostgreSQL 16 support Jun 11, 2026
jeltz added 3 commits June 11, 2026 17:54
These is the raw PostgreSQL code copied using tools/copy_fetools.sh
from REL_16_14.
This takes the diff we have for our patched PostgreSQL 17 tools and
backports it to the PostgreSQL 16 tools.

The commands below were ran to do this:

  git checkout REL_17_10 # In the PostgreSQL repo

  git checkout -b fetools_17_10 main
  rm -r fetools/pg17
  tools/copy_fetools.sh path/to/pg 17
  git add fetools/pg17
  git commit -m REL_17_10
  git checkout pg16
  git diff fetools_17_10 main --relative=fetools/pg17 | git apply -3 --directory=fetools/pg16

The conflicts needed to be solved were minor.
Since we will need more frontend sepcific code to support PostgreSQL 16,
namely the error handling for the JSON parser, we may as well clean up
the pg_tde_fe.c and create a proper C file which we can compile and link
to.
jeltz added 6 commits June 11, 2026 18:03
The changes needed to make pg_tde compile and run against PostgreSQL 16
are:

- Support older API for the JSON parser
- Add a copy of the JSON error message code which can be used by the
  frontend code.
- Backport helper function get_rel_relam()
- Backport foreach_oid() helper macro
- Add non-vectorized read and write to the TDE SMGR
- Include unistd.h where necessary
Apparently PostgreSQL 17 moved some output from stdout to stderr.
Before PostgreSQL 17 pg_rewind did not support in-place tablesapces so
we should just skip those tests on PostgreSQL 16.
Before PostgreSQL 17 the default table access method only mattered when
creating tables, and was not relevant when running ALTER TABLE so there
was no SET ACCESS METHOD DEFAULT.

While doing this we also remove the unnecessary DROP TABLE commands,
which would have added more conditionals on the version, since we
already test DROP TABLE in other places and we remove the whole cluster
anyway.

It is a bit unclear if these test case should even exist in the first
place as we also test this in our pg_regress tests. The pg_regress tests
will be fixed to support PostgreSQL 16 in a later commit.
…ess method

Before PostgreSQL 17 the default table access method only mattered when
creating tables, and was not relevant when running ALTER TABLE so there
was no SET ACCESS METHOD DEFAULT.
…d tables

Before PostgreSQL 17 it was not possible to set the access method on
paritioned tables.
@jeltz

jeltz commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

I can fix the preexisting typos and the potential preexisting bug in a separate PR.

Most of the work doing this was related to making everything build
without injection points as injection points were first added in
PostgreSQL 17.

@dutow dutow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can fix the preexisting typos and the potential preexisting bug in a separate PR.

Yes, that makes sense, it was just easier to add them as comments to this PR.

@jeltz
jeltz merged commit 53d1bf9 into percona:main Jun 12, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants